﻿#include<iostream>
#include<list>

void printList(const std::list<int>& L)
{
	for (std::list<int>::const_iterator it = L.begin(); it != L.end(); ++it)
	{
		std::cout << *it << " ";
	}
	std::cout << '\n';
}

bool myCompare(int v1 , int v2)
{
	return v1 > v2;
}
void test01()
{
	std::list<int> L;
	L.push_back(9);
	L.push_back(6);
	L.push_back(8);
	L.push_back(3);
	L.push_back(5);
	std::cout << "反转前：" << '\n';
	printList(L);

	std::cout << "反转后：" << '\n';
	L.reverse();
	printList(L);

	L.sort();
	printList(L);

	/*L.reverse();
	printList(L);*/

	L.sort(myCompare);
	printList(L);
}


int main()
{
	test01();


	return 0;
}